<div class="row">
    <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
        <div class="widget am-cf">
            <div class="widget-head am-cf">
                <div class="widget-title am-cf">商户列表</div>
                <!-- 工具栏 -->
                <div class="page_toolbar am-margin-bottom-xs am-cf">
                    <div class="am-form-group">
                        <div class="am-btn-group am-btn-group-xs">
                            <a class="am-btn am-btn-default am-btn-success"
                               href="<?= url('agent.merchant/add') ?>">
                                <span class="am-icon-plus"></span> 新增商户
                            </a>
                        </div>
                    </div>
                </div>
                <div class="am-scrollable-horizontal am-u-sm-12">
                    <table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black ">
                        <thead>
                        <tr>
                            <th>小程序id</th>
                            <th>激活状态</th>
                            <th>到期时间</th>
                            <th>添加时间</th>
                            <th>服务年限</th>
                            <th>商户名称</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>

                        <?php if(!$list->isEmpty()):foreach($list as $item):?>
                            <tr>
                                <td class="am-text-middle">
                                    <p class="item-title"><?= $item['wxapp_id'] ?></p>
                                </td>
                                <td class="am-text-middle">
                                    <p class="item-title"><?php if($item['active']==0){ echo '未激活';}else{ echo '已激活';}  ?></p>
                                </td>
                                <td class="am-text-middle"><?= format_time((int)$item['finish_time']) ?></td>
                                <td class="am-text-middle"><?= $item['create_time'] ?></td>
                                <td class="am-text-middle">
                                    <p class="item-title"><?= $item['years'] ?></p>
                                </td>
                                <td class="am-text-middle">
                                    <p class="item-title"><?= $item['wxapp_name'] ?></p>
                                </td>


                                <td class="am-text-middle">
                                    <div class="tpl-table-black-operation">
                                        <a onclick="getInformation('<?= $item['wxapp_name'] ?>','<?= url('agent.agent/getWxappInfo?wxapp_id='.$item['wxapp_id']) ?>','<?= $item['wxapp_id'] ?>')" class="j-delete tpl-table-black-operation-add"
                                           data-id="<?= $item['agent_id'] ?>">
                                            <i class="am-icon-arrow-right"></i> 查看详情
                                        </a>

                                        <a onclick="updateInformation('<?= url('agent.agent/getWxappInfo?wxapp_id='.$item['wxapp_id']) ?>','<?= $item['wxapp_id'] ?>')" class="j-delete tpl-table-black-operation-del"
                                           data-id="<?= $item['agent_id'] ?>">
                                            <i class="am-icon-arrow-right"></i> 修改账户
                                        </a>
                                    </div>
                                </td>


                            </tr>
                        <?php endforeach; else: ?>
                            <tr>
                                <td colspan="4" class="am-text-center">暂无记录</td>
                            </tr>
                        <?php endif; ?>
                        </tbody>
                    </table>
                </div>
                <div class="am-u-lg-12 am-cf">
                    <div class="am-fr"><?= $list->render() ?> </div>
                    <div class="am-fr pagination-total am-margin-right">
                        <div class="am-vertical-align-middle">总记录：<?= $list->total() ?></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    function getInformation(title,url,agentid){
        //console.log(url)
        $('.j-delete').getinfo(title+"详情",url,'get',agentid);
    }
    function updateInformation(url,agentid){
        //console.log(url)
        $('.j-delete').getinfo('修改信息',url,'edit',agentid);
    }
</script>
